using MediatR;
using B.S.XZYData.ErrorCode;
using System;
using System.Collections.Generic;

namespace B.S.XZYData.Api.Read.Application.Command.AssemblyWorkOrder
{
    /// <summary>
    /// 查询装配工单命令
    /// </summary>
    public class QueryAssemblyWorkOrderCommand : IRequest<ApiResult<AssemblyWorkOrderPageResult>>
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int PageNumber { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; } = 30;

        /// <summary>
        /// 单据编号
        /// </summary>
        public string? DocumentNumber { get; set; }

        /// <summary>
        /// 工单数开始值
        /// </summary>
        public int? WorkOrderCountStart { get; set; }

        /// <summary>
        /// 工单数结束值
        /// </summary>
        public int? WorkOrderCountEnd { get; set; }

        /// <summary>
        /// 已结束工单数开始值
        /// </summary>
        public int? FinishedWorkOrderCountStart { get; set; }

        /// <summary>
        /// 已结束工单数结束值
        /// </summary>
        public int? FinishedWorkOrderCountEnd { get; set; }

        /// <summary>
        /// 创建时间开始
        /// </summary>
        public DateTime? CreationTimeStart { get; set; }

        /// <summary>
        /// 创建时间结束
        /// </summary>
        public DateTime? CreationTimeEnd { get; set; }

        /// <summary>
        /// 排序字段
        /// </summary>
        public string SortField { get; set; } = "Id";

        /// <summary>
        /// 排序方向 (asc/desc)
        /// </summary>
        public string SortDirection { get; set; } = "desc";
    }

    /// <summary>
    /// 装配工单分页结果
    /// </summary>
    public class AssemblyWorkOrderPageResult
    {
        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 数据列表
        /// </summary>
        public List<AssemblyWorkOrderDto> Data { get; set; } = new List<AssemblyWorkOrderDto>();

        /// <summary>
        /// 当前页码
        /// </summary>
        public int PageNumber { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int TotalPages { get; set; }
    }

    /// <summary>
    /// 装配工单数据传输对象
    /// </summary>
    public class AssemblyWorkOrderDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 单据编号
        /// </summary>
        public string DocumentNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工单数
        /// </summary>
        public int WorkOrderCount { get; set; }

        /// <summary>
        /// 已结束工单数
        /// </summary>
        public int FinishedWorkOrderCount { get; set; }

        /// <summary>
        /// 单据进度
        /// </summary>
        public decimal DocumentProgress { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatorDate { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string? Creator { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdatorDate { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string? Updator { get; set; }
    }
} 